/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package professor.classes;

import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Gabi
 */
public class ConsultaProfessorTableModel extends AbstractTableModel {

    public List<Professor> listaProfessor;
    private String[] colunas = {"Nome do Professor", "Residencial", "Celular"};

    public ConsultaProfessorTableModel(List<Professor> professor) {
        this.listaProfessor = professor;
    }
    
    public int getRowCount() {
        return listaProfessor.size();
    }

    public int getColumnCount() {
        return colunas.length;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Professor professor = listaProfessor.get(rowIndex);
        if (columnIndex == 0) {
            return professor.getNome();
        } else if (columnIndex == 1) {
            return professor.getFoneFixo();
        } else {
            return professor.getFoneCelular();
        }

    }

    @Override
    public String getColumnName(int column) {
        return colunas[column];
    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
        if (columnIndex == 0) {
            return String.class;
        } else if (columnIndex == 1) {
            return String.class;
        } else {
            return String.class;
        }
    }
}
